import request from '@/utils/request'
import { data } from 'jquery'

//组盘管理添加
export function addItem(data) {
  return request({
    url: '/cqbc/yqSetPlate/addItem',
    method: 'POST',
    data:data
  })
}


//主盘修改
export function editItem(data) {
  return request({
    url: '/cqbc/yqSetPlate/editItem',
    method: 'PUT',
    data:data
  })
}


//组盘管理列表查询
export function getTableList(query) {
    return request({
      url: '/cqbc/yqSetPlate/list',
      method: 'GET',
    params:query
    })
  }
//组盘管理详情
export function yqSetPlateId(id) {
    return request({
      url: '/cqbc/yqSetPlate/'+id,
      method: 'GET',
    })
  }

  //组盘规则添加
export function yqSetPlateRuleAdd(data) {
    return request({
      url: '/cqbc/yqSetPlateRule/addItem',
      method: 'POST',
      data:data
    })
  }

  //组盘规则修改
  export function yqSetPlateRuleeditItem(data) {
    return request({
      url: '/cqbc/yqSetPlateRule/editItem',
      method: 'PUT',
      data:data
    })
  }
  
  //组盘规则列表查询
  export function yqSetPlateRuleList(query) {
    return request({
      url: '/cqbc/yqSetPlateRule/list',
      method: 'GET',
      params:query
    })
  }

  //组盘规则详情
    export function yqSetPlateRuleID(id) {
    return request({
      url: '/cqbc/yqSetPlateRule/'+id,
      method: 'GET',
    })
  }

//组盘规则删除
export function yqSetPlateRuleDelete(id) {
  return request({
    url: '/cqbc/yqSetPlateRule/delete?id='+id,
    method: 'DELETE',
  })
}

//组盘管理删除
export function yqSetPlateDelete(id) {
  return request({
    url: '/cqbc/yqSetPlate/delete?id='+id,
    method: 'DELETE',
  })
}

// 第二步组盘方案
export function setPlantDetail(query) {
  return request({
    url: '/cqbc/yqSetPlateRule/setPlantDetail?count='+query.count+"&size="+query.size,
    method: 'POST',
    data:query.items
  })
}

//获取载体树
export function yqSetPlateRuleTree() {

  return request({
    url: '/cqbc/yqSetPlateRule/tree',
    method: 'POST',

  })
}

//下载到指定载体保存
export function listPackage(data) {
  console.log(JSON.stringify(data.data),"sdklfjlsdkjfkl")
  return request({
    url: '/cqbc/yqSetPlateRule/listPackage2',
    method: 'POST',
    headers:{
      webdownload:false,
      carrierId:data.id
    },
    data:data.data

  })
}